package  
{
	import flash.display.*;
	import flash.events.*;
	import vehicle.*;
	
	public final class WanderTest extends Sprite 
	{
		
		public function WanderTest() 
		{
			m_wander = new SteeredVehicle();
			m_wander.x = this.stage.stageWidth / 2;
			m_wander.y = this.stage.stageHeight / 2;
			this.addChild(m_wander);
			
			m_evader = new SteeredVehicle();
			m_evader.x = Math.random() * this.stage.stageWidth;
			m_evader.y = Math.random() * this.stage.stageHeight;
			this.addChild(m_evader);
			
			m_pursuer = new SteeredVehicle();
			m_pursuer.x = Math.random() * this.stage.stageWidth;
			m_pursuer.y = Math.random() * this.stage.stageHeight;
			this.addChild(m_pursuer);
			
			this.addEventListener(Event.ENTER_FRAME, onEnterFrameHandler);
		}
		
		private function onEnterFrameHandler(evt : Event) : void
		{
			//m_evader.evade(m_wander);
			//m_pursuer.pursue(m_wander);
			m_evader.flee(m_wander.position.clone());
			//m_pursuer.seek(m_wander.position.clone());
			m_pursuer.arrive(m_wander.position.clone());
			m_wander.wander();
			
			m_evader.update();
			m_pursuer.update();
			m_wander.update();
		}

		private var m_wander : SteeredVehicle = null;
		private var m_evader : SteeredVehicle = null;
		private var m_pursuer : SteeredVehicle = null;
		
	}

}

































///////////////////////////////////////////////////////////////////////////////////////////////////
// end file